package Shuffle;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/*	2014-9-1
 * 	Java內建亂數排序(洗牌)功能
 *  只支援List這個方法
 */

public class ShuffleTest {
	public static void main(String[] args) {
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++){	
            list.add(new Integer(i));
        }
        System.out.println("尚未打亂前:");
        System.out.println(list);
 
        for (int i = 0; i < 5; i++) {
            System.out.println("第" + i + "次打亂：");
            Collections.shuffle(list);
            System.out.println(list);
        }
    }
}
